package com.iptv.grape.event.imp;

import com.iptv.grape.BaseActivity;
import com.iptv.grape.bu.GrapeContext;
import com.iptv.grape.domain.Bookmark;
import com.iptv.grape.event.JSRequest;
import com.iptv.grape.event.msg.GetBookmarkListArgs;
import com.iptv.grape.event.proc.IWebViewMessageProc;
import com.iptv.grape.video.XMediaPlayer;

import java.util.List;

public class GetBookmarkList implements IWebViewMessageProc {
    @Override
    public void init(JSRequest jsRequest) {

    }

    @Override
    public String procMessage(BaseActivity baseActivity, XMediaPlayer mediaPlayer) {
        List<Bookmark> list = GrapeContext.curGrapeContext().getBookmarkList().toList();
        GetBookmarkListArgs args = new GetBookmarkListArgs();
        args.setList(list);
        return new com.google.gson.Gson().toJson(args);
    }
}
